# Which compiler
CC = gcc
AR = ar
AT = @

# Option for development
CFLAGS = -g -O2 -Wall
# Option for release
# CFLAGS = -O -Wall

# LIBS = 

PROJ_ROOT_PATH = ../../..
TEST_SRC_PATH = ../..
OUTPUT = exec

# source file
SRCS := main.c
SRCS += $(TEST_SRC_PATH)/ringbuffer.c
SRCS += $(PROJ_ROOT_PATH)/sysshell/sys_shell.c

OBJS = $(SRCS:.c = .o)

# Where are include files kept
INCLUDES := -I$(TEST_SRC_PATH)
INCLUDES += -I$(PROJ_ROOT_PATH)/sysshell


all: $(OUTPUT)
	$(AT)echo "build done"

$(OUTPUT): $(OBJS)
	$(AT)echo "start $(OUTPUT)"
	$(AT)$(CC) $^ -o $@ $(CFLAGS) $(INCLUDES) $(LIBS)
	$(AT)echo "end $(OUTPUT)"

%.o: %.c
	$(AT)echo "start $(%.o)"
	$(AT)$(CC) -c $< $(CFLAGS)
	$(AT)echo "end $(%.o)"

.PHONY: clean
clean:
	$(AT)-rm -rf $(OUTPUT) *.o $(LUA_SRCS_PATH)/*.o
